package com.itech.stocks;

public class StockAlert {
	public static final String SYMBOL = "symbol";
	public static final String STOCK_ID = "stockId";
	public static final String ALERT_COUNT = "alertCount";
	public static final String PRICE = "price";
	public static final String CRITERIA = "criteria";
	enum Criteria {
		LT,
		GT,
		EQ
	}
	private String symbol;
	private String stockId;
	private int alertCount;
	private double price;
	private Criteria criteria;
	private int alertCounter;
	
	public StockAlert() {
		
	}
	
	
	public StockAlert(int alerCount, Criteria criteria, double price,
			String stockId, String symbol) {
		super();
		this.alertCount = alerCount;
		this.criteria = criteria;
		this.price = price;
		this.stockId = stockId;
		this.symbol = symbol;
	}
	
	public String getSymbol() {
		return symbol;
	}
	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}
	public String getStockId() {
		return stockId;
	}
	public void setStockId(String stockId) {
		this.stockId = stockId;
	}
	public int getAlertCount() {
		return alertCount;
	}
	public void setAlertCount(int alertCount) {
		this.alertCount = alertCount;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public Criteria getCriteria() {
		return criteria;
	}
	public void setCriteria(Criteria criteria) {
		this.criteria = criteria;
	}

	public void increaseCounter() {
		this.alertCounter++;
	}


	public int getAlertCounter() {
		return alertCounter;
	}
	
	@Override
	public String toString() {
		return "StockId-" + getStockId() + ", Symbol-" + getSymbol() + ", Criteria-" + getCriteria().name() +
				", Price-" + getPrice() + ", TotalAlertCount-" + getAlertCount() + 
				", AlertCount-" + getAlertCounter();
	}

	public void resetCounter() {
		this.alertCounter = 0;		
	}	
	
}
